package cn.yshujia.controller;

import cn.yshujia.domain.vo.ApiVO;
import cn.yshujia.service.impl.ClassifyServiceImpl;
import cn.yshujia.service.impl.LabelServiceImpl;
import cn.yshujia.service.impl.ResourcesServiceImpl;
import cn.yshujia.service.impl.RouterServiceImpl;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author YShuJia
 * @create 2025/3/26
 * @description SystemController
 */

@RestController
@Tag (name = "System", description = "系统模块Api")
public class SystemController {
	
	@Resource
	private ClassifyServiceImpl classifyService;
	
	@Resource
	private LabelServiceImpl labelService;
	
	@Resource
	private ResourcesServiceImpl resourcesService;
	
	@Resource
	private RouterServiceImpl routerService;
	
	@GetMapping ("/admin/system/count")
	@Operation (summary = "获取系统模块数据统计")
	public ApiVO<Map<String, Number>> count() {
		Map<String, Number> map = Map.of(
				"classify", classifyService.count(),
				"label", labelService.count(),
				"resources", resourcesService.count(),
				"router", routerService.count()
		);
		return ApiVO.success(map);
	}
}
